import request from "@/utils/request";

//查询所有仓库
export const getWarehouseList = (
  page,
  pageSize,
  name,
  cityId,
  personChargeName
) =>
  request.get(
    `/warehouse/list?page=${page}&pageSize=${pageSize}&name=${name}&cityId=${cityId}&personChargeName=${personChargeName}`
  );
// export const getWarehouseList = () => request.get(`/warehouse/list`)
export const getWarehouseListAll = () => request.get(`/warehouse/listAll`);
//添加仓库
export const addWarehouse = (data) => request.post(`/warehouse`, data);

//修改仓库
export const updateWarehouse = (data) => request.put(`/warehouse`, data);

//删除仓库
export const deleteWarehouse = (id) => request.delete(`/warehouse/${id}`);

//分页查询库区
export const getWarehouseAreaPage = (page, pageSize, name, warehouseId) =>
  request.get(
    `/warehouse/area?page=${page}&pageSize=${pageSize}&name=${name}&warehouseId=${warehouseId}`
  );
//数据字典查询
export const getDict = () => request.get(`/warehouse/dictData`);

//新增库区
export const addWarehouseArea = (data) => request.post(`/warehouse/area`, data);
//修改库区
export const updateWarehouseArea = (data) =>
  request.put(`/warehouse/area`, data);
//删除库区
export const deleteWarehouseArea = (id) =>
  request.delete(`/warehouse/area/${id}`);
//查询所有库区
export const getWarehouseAreaListAll = () =>
  request.get(`/warehouse/area/list`);

//查询库位分页
export const getWarehouseLocationListPage = (
  page,
  pageSize,
  warehouseId,
  warehouseAreaId
) =>
  request.get(
    `/warehouse/local?page=${page}&pageSize=${pageSize}&warehouseId=${warehouseId}&warehouseAreaId=${warehouseAreaId}`
  );

//根据仓库id查询库区
export const getWarehouseAreaListByWarehouseId = (warehouseId) =>
  request.get(`/warehouse/area/${warehouseId}`);

//根据库区Id查询库区类型
export const getWarehouseAreaTypeListByWarehouseAreaId = (warehouseAreaId) =>
  request.get(`/warehouse/area/type/${warehouseAreaId}`);

//新增库位信息
export const addWarehouseLocation = (data) =>
  request.post(`/warehouse/local`, data);
//修改库位信息
export const updateWarehouseLocation = (data) =>
  request.put(`/warehouse/local`, data);
//删除库位信息
export const deleteWarehouseLocation = (id) =>
  request.delete(`/warehouse/local/${id}`);